import Vue from 'vue'

import axios from 'axios'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import ElementUI from 'element-ui'
import './styles/element-variables.scss'

// echarts
import echarts from 'echarts'
Vue.prototype.$echarts = echarts

import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard)

import { Uploader } from 'vant'
Vue.use(Uploader)

import App from './App'
import store from './store'
import router from './router'

import * as filters from './filters/index.js'
import './icons'
import '@/styles/index.scss' // global css

import './permission'

Vue.prototype.$http = axios

Vue.config.productionTip = false

Vue.use(ElementUI, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

// 消息提示框距离顶部的距离
const message = Vue.prototype.$message
Vue.prototype.$message = (options) => {
  return message({
    ...options,
    offset: 60
  })
}

Object.keys(filters).forEach(key => { // 过滤器，在组件内使用
  Vue.filter(key, filters[key])
})

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
